package com.mocha.bss.feign.general.api.fallback;


import com.coffee.attachment.AttachVisualDTO;
import com.coffee.attachment.ExcelDocumentDTO;
import com.mocha.bss.feign.general.api.MochaAttachmentFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

@Slf4j
@Component
public class MochaAttachmentFeignFallback implements FallbackFactory<MochaAttachmentFeign> {
    @Override
    public MochaAttachmentFeign create(Throwable cause) {
        return new MochaAttachmentFeign(){


            @Override
            public  Long saveDocument(@RequestBody ExcelDocumentDTO entity) {
                log.error("MochaAttachmentFeign saveDocument Throwable: {}", cause.getMessage());
                return null;
            }

            @Override
            public Long saveVisual(@RequestBody AttachVisualDTO entity) {
                log.error("MochaAttachmentFeign saveVisual Throwable: {}", cause.getMessage());
                return null;
            }

        };
    }


}
